package yz.mr.FiltrationText3;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class FiltrationText3Mapper extends Mapper<LongWritable, Text,Text,Student> {
    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, Student>.Context context) throws IOException, InterruptedException {
        //1500100001	施笑槐,22,女,文科六班,406
        String[] split = value.toString().split("\t");
        String id = split[0];
        String otherInfo = split[1];
        String[] split1 = otherInfo.split(",");
        Student student = new Student(id, split1[0], split1[1], split1[2], split1[3], Integer.parseInt(split1[4]));
        context.write(new Text(student.getClazz()),student);
    }
}
